<%
String logged = "";
if(request.getSession().getAttribute("status") != null){
	logged = (String)request.getSession().getAttribute("status");
}else if(!logged.equals("ingelogd")){
	response.sendRedirect("index.jsp?message=Log+eerst+in+om+verder+te+gaan");
}

//session.removeAttribute("status");
%>
<%@page import="model.*" %>
<%@page import="domein.*"%>
<%String eventNaam =""; String plaats =""; String Titel =""; String contactpersoon =""; String Organisator ="";%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Incentro Event Inviting System</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico" />
</head>

<body>

	<div id="wrapper">
	
		<div id="header">
			<a href="../eOverzicht.jsp" id="logo"><img src="img/logo.png" /></a>
		</div>
			
		<%
		OpmerkingIO oIo = new OpmerkingIO();
	  	String datum = oIo.getDate();
	  	
	  	String status = request.getParameter("status");
	  	String opmerking = request.getParameter("opmerking");
	  	String eventID = request.getParameter("eventID");
	  	String gebruikerID = (String)request.getSession().getAttribute("userMail");
	  	String email	= request.getParameter("genodigdeID"); 
	  	
	  	if (!status.equals("0")){	 oIo.wijzigStatus(status, email, eventID);
		 }
	  	oIo.insertOpmerking(email, datum, opmerking, gebruikerID, eventID, status);
	  	
	  	
	  	if (status.equals("1")){	  		status = "Geaccepteerd"; 	}
	  	else if(status.equals("2")) { 		status = "Afgewezen";  		}
	  	else if(status.equals("0")) { 		status = ""				;	}
	  	else{	  							status = "Afwachtend"; 		}
	  	
	
	 
	  	
	  	%>
		<div id="search-form">		
			<a href="status.jsp?eventID=<% out.print(eventID); %>"><input type="submit" value="Terug" class="terugButton" /></a>
	  	</div>

	  	U heeft een nieuwe opmerking toegevoegd!
	  	<table class="table" summary="Evenementen overzicht">
			<thead>
				<tr>
					<th scope="col">Contactpersoon</th>
					<th scope="col">datum</th>
					<th scope="col">opmerking</th>
					<th scope="col">status</th>
				</tr>
			</thead>
			<tbody>
						
					<td><%out.print(gebruikerID);%></td>
					<td><%out.print(datum); %></td>
					<td><%out.print(opmerking); %></td> 
					<td><%out.print(status); %></td>

				</tr>
			</tbody>
		</table>	  	
		
	</div>

</body>

</html>